package com.ruoyi.web.controller.system;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import com.ruoyi.system.domain.SysServerRegiste;
import com.ruoyi.system.service.ISysServerRegisteService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 系统注册Controller
 *
 * @author jijinwu
 * @date 2025-04-20
 */
@Api(tags = "系统注册")
@RestController
@RequestMapping("/system/registe")
public class SysServerRegisteController extends BaseController
{
    @Autowired
    private ISysServerRegisteService sysServerRegisteService;

    /**
     * 查询系统注册列表
     */
    @ApiOperation(value = "查询系统注册列表")
    @PreAuthorize("@ss.hasPermi('system:registe:list')")
    @GetMapping("/list")
    public TableDataInfo list(SysServerRegiste sysServerRegiste)
    {
        startPage();
        List<SysServerRegiste> list = sysServerRegisteService.selectSysServerRegisteList(sysServerRegiste);
        return getDataTable(list);
    }

    /**
     * 导出系统注册列表
     */
    @ApiOperation(value = "导出系统注册列表")
    @PreAuthorize("@ss.hasPermi('system:registe:export')")
    @Log(title = "系统注册", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, SysServerRegiste sysServerRegiste)
    {
        List<SysServerRegiste> list = sysServerRegisteService.selectSysServerRegisteList(sysServerRegiste);
        ExcelUtil<SysServerRegiste> util = new ExcelUtil<SysServerRegiste>(SysServerRegiste.class);
        util.exportExcel(response, list, "系统注册数据");
    }

    /**
     * 获取系统注册详细信息
     */
    @ApiOperation(value = "获取系统注册详细信息")
    @PreAuthorize("@ss.hasPermi('system:registe:query')")
    @GetMapping("/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id)
    {
        return success(sysServerRegisteService.selectSysServerRegisteById(id));
    }

    /**
     * 新增系统注册
     */
    @ApiOperation(value = "新增系统注册")
    @PreAuthorize("@ss.hasPermi('system:registe:add')")
    @Log(title = "系统注册", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    public AjaxResult add(@RequestBody SysServerRegiste sysServerRegiste)
    {
        return toAjax(sysServerRegisteService.insertSysServerRegiste(sysServerRegiste));
    }

    /**
     * 修改系统注册
     */
    @ApiOperation(value = "修改系统注册")
    @PreAuthorize("@ss.hasPermi('system:registe:edit')")
    @Log(title = "系统注册", businessType = BusinessType.UPDATE)
    @PutMapping("/edit")
    public AjaxResult edit(@RequestBody SysServerRegiste sysServerRegiste)
    {
        return toAjax(sysServerRegisteService.updateSysServerRegiste(sysServerRegiste));
    }

    /**
     * 删除系统注册
     */
    @ApiOperation(value = "删除系统注册")
    @ApiImplicitParam(name = "id", value = "系统注册D",paramType = "query", dataType = "Integer")
    @PreAuthorize("@ss.hasPermi('system:registe:remove')")
    @Log(title = "系统注册", businessType = BusinessType.DELETE)
	@DeleteMapping("/remove/{ids}")
    public AjaxResult remove(@PathVariable Integer[] ids)
    {
        return toAjax(sysServerRegisteService.deleteSysServerRegisteByIds(ids));
    }
}
